from UI_web_A3mall.po_pytest_selenium.config.config import config

from selenium.webdriver.common.by import By

import time
class Page1(config):
    #点击登录 /html/body/div[1]/div/div[2]/ul/li[1]/a
    login_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def login(self):
        self.click(self.login_loc)
    #断言 会员登录 class="reg-new"
    dy1_text = (By.CLASS_NAME,"reg-new")
    def dy1(self):
        return  self.text(self.dy1_text)
    #输入用户名 name="username"
    username_loc = (By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'13811033962')
    #输入密码 name="password"
    password_loc = (By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'123456')
    #点击登录按钮 class="finish-btn"
    butten_loc = (By.CLASS_NAME,'finish-btn')
    def butten(self):
        self.click(self.butten_loc)
    #断言欢迎回来 /html/body/div[1]/div/div[2]/ul/li[1]/a
    dy2_text = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def dy2(self):
        self.text(self.dy2_text)
    # 首页 /html/body/div[3]/div[2]/ul/li[1]/a
    def test_A3mall_login_01(self):
        self.open_url('http://10.59.9.12:7001/')
        self.login()
        print(self.dy1())
        self.username()
        self.password()
        time.sleep(6)
        self.butten()
        time.sleep(6)
        print(self.dy2())
